<template>
	<view>
		<view class="block">
			<view class="title title1">
				选择支付方式
			</view>
			<view class="content">
				<view class="pay-list">
					<view class="row row1" @tap="paytype='alipay'">
							<view class="left">
								<image src="../../static/zhifubao.png"></image>
							</view>
							<view class="center">
								支付宝支付
							</view>
							<view class="right">
								<radio :checked="paytype=='alipay'" color="#f06c7a" />
							</view>
					</view>
					<view class="row" @tap="paytype='wxpay'">
							<view class="left">
								<image src="../../static/weixin.png"></image>
							</view>
							<view class="center">
								微信支付
							</view>
							<view class="right">
								<radio :checked="paytype=='wxpay'" color="#f06c7a" />
							</view>
					</view>
				</view>
			</view>
		</view>
		<view class="block">
			<view class="title">
				充值金额
			</view>
			<view class="contents">
				<view>￥</view>
				<input type="number" v-model="inputAmount"/>
			</view>
			<!-- <view class="smalls">可用余额 0 元</view> -->
		</view>
		<view class="pay">
			<view class="btn" @tap="doDeposit">下一步</view>
			<view class="tis">
				<image class="tis_img" src="../../static/bao.png"></image>
				账户安全险保障中
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				inputAmount:'',//金额
				amountList:[10,50,100],//预设3个可选快捷金额
				paytype:'alipay'//支付类型
			};
		},
		methods:{
			doDeposit(){
				if (parseFloat(this.inputAmount).toString() == "NaN") {
					uni.showToast({title:'请输入正确金额',icon:'none'});
					return ;
				}
				if(this.inputAmount<=0){
					uni.showToast({title:'请输入大于0的金额',icon:'none'});
					return ;
				}
				if(parseFloat(this.inputAmount).toFixed(2)!=parseFloat(this.inputAmount)){
					uni.showToast({title:'最多只能输入两位小数哦~',icon:'none'});
					return ;
				}
				//模板模拟支付，实际应用请调起微信/支付宝
				uni.showLoading({
					title:'支付中...'
				});
				setTimeout(()=>{
					uni.hideLoading();
					uni.showToast({
						title:'支付成功'
					});
					setTimeout(()=>{
						
					},300);
				},700)
			}
		},
		onLoad() {
			
		},
	}
</script>

<style lang="scss">
	.block{
		padding: 20upx;
		.title{
			width: 100%;
			font-size: 34upx;
		}
		.title1{
			background: #FAFAFA;
			padding: 25upx 0;
			text-indent: 10upx;
			color: #979797;
		}
		.content{
			.my{
				width: 100%;
				height: 120upx;
				display: flex;
				align-items: center;
				font-size: 30upx;
				border-bottom: solid 1upx #eee;
			}
			.amount{
				width: 100%;
				
				.list{
					display: flex;
					justify-content: space-between;
					padding: 20upx 0;
					.box{
						width: 30%;
						height: 120upx;
						display: flex;
						justify-content: center;
						align-items: center;
						border-radius: 10upx;
						box-shadow: 0upx 5upx 20upx rgba(0,0,0,0.05);
						font-size: 36upx;
						background-color: #f1f1f1;
						color: 333;
						&.on{
							background-color: #f06c7a;
							color: #fff;
						}
					}
				}
				.num{
					margin-top: 10upx;
					display: flex;
					justify-content: flex-end;
					align-items: center;
					.text{
						padding-right: 10upx;
						font-size: 30upx;
					}
					.input{
						width: 28.2vw;
						border-bottom: solid 2upx #999;
						
						justify-content: flex-end;
						align-items: center;
						input{
							margin: 0 20upx;
							height: 60upx;
							font-size: 30upx;
							color: #f06c7a;
							justify-content: flex-end;
							align-items: center;
						}
					}
				}
			}
			.pay-list{
				width: 100%;
				.row1{
					border-bottom: solid 1upx #eee;
				}
				.row{
					width: 100%;
					height: 100upx;
					display: flex;
					align-items: center;
					.left{
						width: 80upx;
						flex-shrink: 0;
						display: flex;
						align-items: center;
						image{
							width: 45upx;
							height: 45upx;
						}
					}
					.center{
						width: 100%;
						font-size: 30upx;
					}
					.right{
						width: 100upx;
						flex-shrink: 0;
						display: flex;
						justify-content: flex-end;
					}
				}
			}
		}
	}
	.pay{
		margin-top: 20upx;
		width: 100%;
		display: flex;
		justify-content: center;
		flex-wrap: wrap;
		.btn{
			width: 90%;
			height: 80upx;
			border-radius: 80upx;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #fff;
			background-color: $base-index-color;
			box-shadow: 0upx 5upx 10upx rgba(0,0,0,0.2);
		}
		.tis{
			position: absolute;
			bottom: 100upx;
			width: 100%;
			font-size: 24upx;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #999;
			.terms{
				color: #5a9ef7;
			}
		}
	}
	.contents{
		display: flex;
		justify-content: space-between;
		padding-top: 30upx;
		position: relative;
		height: 100upx;
	}
	.contents input{
		width: 100%;
		position: absolute;
		border-bottom: 1px solid #F3F3F3;
		bottom: 0;
		text-indent: 5upx;
		text-align: center;
		font-size: 60upx;
	}
	.smalls{
		color: gray;
		font-size: 25upx;
		padding: 20upx 0;
	}
	
	.tis_img{
		width: 28upx;
		height: 30upx;
		margin: 0 10upx;
	}
	.uni-radio-input .uni-radio-input-checked{
		background-color: #000!important;
		border-color: #000!important;
	}
</style>
